<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>redmoonid初始化</title>
  <link type="text/css" rel="stylesheet" th:href="@{${skinPath} + '/css.css'}"/>
  <script th:src="@{/inc/common.js}"></script>
</head>
<body>
<table cellSpacing="0" cellPadding="0" width="100%">
  <tbody>
  <tr>
    <td class="tdStyle_1">自增长ID初始化</td>
  </tr>
  </tbody>
</table>

<form name="form1" id="form1" method="get" action="?op=start" style="margin-top: 10px">
  <input type="hidden" name="op" value="start"/>
  <input type="hidden" name="formName" value=""/>
  <input type="hidden" name="nowId" value=""/>
  <table class="tabStyle_1 percent80">
    <tr>
      <td class=tabStyle_1_title width="20%">表名称</td>
      <td class=tabStyle_1_title width="20%">idType</td>
      <td class=tabStyle_1_title width="20%">当前表中最大id</td>
      <td class=tabStyle_1_title width="20%">自增长id</td>
      <td class=tabStyle_1_title width="20%"><input type="button" class="btn btn-default" onclick="allTable()" value="初始化全部表"/></td>
    </tr>

    <tr th:each="ti: ${tInfo}">
      <td><span th:text="${ti.tName}"></span>
        <input type="hidden" th:id="'tname'+${ti.k}" th:value="${ti.tName}"/>
      </td>
      <td th:text="${ti.k}"></td>
      <td th:text="${ti.mid}" th:style="${ti.style}"></td>
      <td>
        <input type="text" th:id="'nid'+${ti.k}" th:value="${ti.nid}"/>
      </td>
      <td align="center">
        <input type="button" th:onclick="|csh(${ti.k})|" class="btn btn-default" value="初始化"/>
        &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" th:onclick="|xg(${ti.k})|" class="btn btn-default" value="修改"/>
      </td>
    </tr>

  </table>
</form>
</body>
<script th:inline="javascript">
  function allTable() {
    if (confirm("您确定要初始化全部表么？")) {
      o("formName").value = "all";
      o("form1").submit();
    }
  }

  function csh(k) {
    o("formName").value = o("tname" + k).value;
    o("form1").submit();
  }

  function xg(k) {
    o("formName").value = o("tname" + k).value;
    o("nowId").value = o("nid" + k).value;
    o("form1").submit();
  }
</script>
</html>
